Skip to content

Conversation

@buffalojoec
Copy link
Contributor

Problem

Similar to solana-program/config#16, the Address Lookup Table program imposes a limit on the provided instruction buffer length. However, the ExtendLookupTable instruction uses a vector of pubkeys, resulting in a vector length stored in the first 8 bytes of the buffer after the discriminator.

If that vector length is very large, even if the rest of the buffer is invalid, the allocator in the BPF version will attempt to allocate a large vector and exhaust the heap.

Summary of Changes

Add a safe_deserialize_instruction helper to check the vector length before attempting deserialization.

@buffalojoec buffalojoec requested a review from joncinque November 7, 2024 16:28
Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me! Just a few little bits for maintenance

Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

@buffalojoec buffalojoec merged commit cf11c00 into main Nov 8, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants